package com.springboot.bean;

import org.apache.shiro.session.Session;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class ApplicationContext {

    private final Map<String, Session> map = new HashMap<>();

    public void pushMap(String name, Session session) {
        try {
            Session temp = map.get(name);
            if (temp != null)
                temp.stop();
        } finally {
            map.put(name, session);
        }
    }

}
